<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
<a href="javascript:;" style="display:block;margin: 10px;" onclick="return fn();">切换</a>
<img id="img" src="image2/1.jpg" width="400px"/>


<script>

    var img = document.getElementById("img");
    function fn(){
        img.src = "image2/2.jpg";
//        return false;
    }

</script>
</body>
</html>